package comment

import (
	"github.com/flipped-aurora/gin-vue-admin/server/middleware"
	"github.com/gin-gonic/gin"
)

type CommentsRouter struct {}

// InitCommentsRouter 初始化 comments表 路由信息
func (s *CommentsRouter) InitCommentsRouter(Router *gin.RouterGroup,PublicRouter *gin.RouterGroup) {
	commentsRouter := Router.Group("comments").Use(middleware.OperationRecord())
	commentsRouterWithoutRecord := Router.Group("comments")
	commentsRouterWithoutAuth := PublicRouter.Group("comments")
	{
		commentsRouter.POST("createComments", commentsApi.CreateComments)   // 新建comments表
		commentsRouter.DELETE("deleteComments", commentsApi.DeleteComments) // 删除comments表
		commentsRouter.DELETE("deleteCommentsByIds", commentsApi.DeleteCommentsByIds) // 批量删除comments表
		commentsRouter.PUT("updateComments", commentsApi.UpdateComments)    // 更新comments表
	}
	{
		commentsRouterWithoutRecord.GET("findComments", commentsApi.FindComments)        // 根据ID获取comments表
		commentsRouterWithoutRecord.GET("getCommentsList", commentsApi.GetCommentsList)  // 获取comments表列表
	}
	{
	    commentsRouterWithoutAuth.GET("getCommentsPublic", commentsApi.GetCommentsPublic)  // comments表开放接口
	}
}
